package com.briup.recognition.service.impl;

import com.briup.recognition.bean.Category;
import com.briup.recognition.bean.CategoryExample;
import com.briup.recognition.bean.Greenhouse;
import com.briup.recognition.bean.GreenhouseExample;
import com.briup.recognition.dao.CategoryMapper;
import com.briup.recognition.dao.GreenhouseMapper;
import com.briup.recognition.service.ICategoryService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class CategoryServiceImpl implements ICategoryService {

    @Resource
     private CategoryMapper categoryMapper;
    @Override
    public List<Category> query() {
        CategoryExample example=new CategoryExample();

        return categoryMapper.selectByExample(example);
    }

    @Override
    public void saveOrUpdate(Category category) {
        if (category.getId() != null) {
            categoryMapper.updateByPrimaryKey(category);
        } else {
            categoryMapper.insert(category);

        }
    }

    @Override
    public void deleteById(long id) {categoryMapper.deleteByPrimaryKey(id);

    }



    }
